package list_Node;

//83. 删除排序链表中的重复元素(保留一个)
public class Num83_deleteDuplicates {
    public ListNode deleteDuplicates1(ListNode head) {

        if (head==null)return null;
        ListNode prev=head;
        ListNode cur=null;
        while (prev!=null&&prev.next!=null){
            cur=prev.next;
            while (cur!=null&&prev.val==cur.val){
                cur=cur.next;
            }
            prev.next=cur;
            prev=cur;
        }
        return head;

    }


}
